package cn.edu.scau.cmi.yangqing.singleton;

import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class MyControllerMutil implements Initializable {

	   @FXML
	   private Button myButton;

	   @FXML
	   private TextField myTextField;

	   @FXML
	   private TextArea myTextField2;
	   
	   public void initialize(URL location, ResourceBundle resources) {}

	   public void showDateTime(ActionEvent event) {
		   String[] nameList = {"朱德","彭德怀","林彪","刘伯承","贺龙","陈毅","罗荣桓","徐向前","聂荣臻","叶剑英","张三","李四"};
		   String text = "";
		   int i=1;
			for (String string : nameList) {
				System.out.print("输入人名："+string);
				MutilChairman mutilChairmans = MutilChairman.getInstance(string);
				if(mutilChairmans!=null) {
					System.out.println("  创建对象："+mutilChairmans.getName());
					text += "第" +i+"个元帅:" + mutilChairmans.getName()+'\n';
					i++;
				}
				else System.out.println();
			}
			myTextField2.setText(text);
	   }
}
